package day03;

import com.sun.org.apache.xerces.internal.impl.xs.models.XSCMBinOp;

public class OperDemo3 {
    public static void main(String[] args) {
     /*
        //3.逻辑运算符号：&& || ！
        int a=5,b=10,c=5;
        boolean b1 = b>=a && b<c;
        System.out.println(b1);//true&false = false
        System.out.println(b<=c && b>a);// f&f=f
        System.out.println(a==c && c>b);//f&f=f
        System.out.println(b!=c && a<b);//t&t=t

        int age =40;
        System.out.println(age>=18 && age<=50 ); //年龄在18到50之间
        int score =60;
        System.out.println(score>=0 && score<=100);//分数在0~100之间

      */
/*
        int a=10,b=20,c=10;
        boolean b1 = b>10 && b>a && a==c;
        System.out.println(b1);//t
        System.out.println(a==c && b>c);
        System.out.println(a!=b && a>=c);
        System.out.println(b>=c && a==c);

        int age = 70;
        System.out.println(age>=20 && age<=80);
        int score = 90;
        System.out.println(score>=60 && score<=100);


 */
/*
        int a=5,b=10,c=5;
        System.out.println(b>=a || b<c);//t||f =t
        System.out.println(b<=c || b>a);//f||t=t
        System.out.println(b!=c || a<b);//t||t =t
        System.out.println(a==b || b<c);//f||f =f
        int score =80;
        System.out.println(score<0 || score>100);//f 成绩不合法验证
        System.out.println("----");

        boolean b2= !(a<b);
        System.out.println(b2);//f
        System.out.println(!(a>b));//t

 */
//短路：
        int a =5,b=10,c=5;
        boolean b3 = a>b && c++>2;
        System.out.println(b3);//f
        System.out.println(c);//5 a>b为f ，发生短路了，后面的c++就不执行

        boolean b4 =a<b && c++>2;
        System.out.println(b4);//t
        System.out.println(c);//6  a<b为t 没发生短路，后面c++接着执行


        boolean b5 = a<b || c++>2;  //  ||遇见一个t则为短路
        System.out.println(b5);//t
        System.out.println(c);//5 a<b为t ，发生短路了，后面的c++就不执行





    }
}
